import { defineComponent, h, getCurrentInstance, reactive, watchEffect } from 'vue';
import { Tag } from 'ant-design-vue';
export default defineComponent({
    name: 'HStatusTag',
    components: { Tag },
    props: {
        status: {
            type: String,
            default: ''
        },
        type: {
            type: String,
            default: 'task'
        }
    },
    setup(props, ctx) {
        const instance: any = getCurrentInstance();
        const state = reactive({
            color: 'default',
            text: ''
        });
        const statusColors = {
            task: { '1': 'default', '1.1': 'green', '1.2': 'orange', '2': 'blue', '3': 'green', '4': 'pink', '5': '#BFBFBF', '6': 'red', '7': 'orange', '8': 'red' },
            version: {
                '1': 'default',
                '2': 'blue',
                '3': 'green',
                '4': 'orange',
                '5': 'red'
            }
        };
        const statusTypes = {
            task: 'status',
            version: 'versionStatus'
        };
        const getColor = () => {
            return statusColors[props.type][props.status];
        };
        const getText = () => {
            return instance.proxy.$filters.valToNameFilter(statusTypes[props.type], props.status);
        };
        const init = () => {
            state.color = getColor();
            state.text = getText();
        };
        watchEffect(init);
        return () => h(Tag, { color: state.color }, { default: () => state.text });
    }
});